Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add moveByVelocityZBodyFrame #3475

Merged
merged 2 commits into from
Mar 23, 2021
Merged

Add moveByVelocityZBodyFrame #3475

merged 2 commits into from
Mar 23, 2021

Conversation

meurissemax
Copy link
Contributor

@meurissemax meurissemax commented Mar 16, 2021

Fixes: #3476

About

To be consistent, I propose to add function moveByVelocityZBodyFrame to Multirotor API.

Indeed, the function moveByVelocity has its associated moveByVelocityBodyFrame. It is not the case for the function moveByVelocityZ.

More over, I experienced a small problem with function moveByVelocityBodyFrame (when used to move in X-Y plane): multiple calls, separated by a small amount of time (for example, the time to process and analyze an image) leads the UAV to move downwards gradually.

A small video illustrating this problem is available here: https://youtu.be/iiWdGzhMKqA.

The use of moveByVelocityZ solved this problem, but unfortunately its associated moveByVelocityZBodyFrame does not exist, so I propose to add it.

The implementation is (almost) exactly the same as this PR: #3169.

Usage: moveByVelocityZBodyFrameAsync(vx, vy, z, duration, drivetrain (optional), yaw_mode (optional), vehicle_name (optional)).

How Has This Been Tested?

I used the modified version of the AirSim plugin in my Python project. I tested the function in multiple environments by simply moving the UAV using moveByVelocityZBodyFrame . The UAV successfully moves by velocity in its direction's X-Y frame.

A use case of my project is available here: https://youtu.be/mODIlYtCzP8?t=15.

In this example, the drone moves using moveByVelocityZBodyFrame. It can be seen that the drone stops very briefly from time to time to perform calculations and still keeps a constant altitude during its movement.

Screenshots (if appropriate):

/

@ghost
Copy link

ghost commented Mar 16, 2021

CLA assistant check
All CLA requirements met.

Copy link
Contributor

@rajat2004 rajat2004 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The implementation is almost exactly the same as moveByVelocityBodyFrame, so maybe it can be extracted out to a common method? I can't think of any good way to do this currently, if anyone has any ideas that would be great, else can be left as is

AirLib/src/vehicles/multirotor/api/MultirotorApiBase.cpp Outdated Show resolved Hide resolved
PythonClient/airsim/client.py Show resolved Hide resolved
@meurissemax
Copy link
Contributor Author

Hello @rajat2004 👋 , thank you for your review!

As I mentioned, the implementation is almost exactly the same as moveByVelocityBodyFrame. More precisely, they have in common two lines of code that transform the velocities in the world frame to the corresponding values in the drone frame.

This transformation can certainly be computed in another function, but to be honest, I don't known how and where to add properly such a function, so I prefer to leave it as it is for now.

I create a new commit with modifications according to your advice.

@rajat2004
Copy link
Contributor

@meurissemax Yeah, the duplication is pretty small so shouldn't be a problem ig

@jonyMarino
Copy link
Collaborator

Hi @meurissemax! Thanks for your contribution!

@jonyMarino jonyMarino merged commit bb6c487 into microsoft:master Mar 23, 2021
meurissemax pushed a commit to meurissemax/autonomous-drone that referenced this pull request Mar 25, 2021
* Update to AirSim version including my contribution (microsoft/AirSim#3475)
* Update controllers according to new version of AirSim
meurissemax added a commit to meurissemax/autonomous-drone that referenced this pull request Jul 13, 2021
* Update to AirSim version including my contribution (microsoft/AirSim#3475)
* Update controllers according to new version of AirSim
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

moveByVelocityZ in body frame
3 participants